package end.bean.shiro;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonIgnore;

import end.bean.BaseBean;

/**
 * 
 * Role.java 2016-7-9
 *
 * Copyright zhaocj  Inc. All rights reserved.
 * Love Me Like Love Justin Bieber
 */
@SuppressWarnings("serial")
public class Role extends BaseBean implements Serializable{

	private Integer id;
	private String name;
	private String description;
	private List<Resource> resources;
	private List<Manager> Managers;
	private char useStatus;
	private String code;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public List<Resource> getResources() {
		return resources;
	}
	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}
	public List<Manager> getManagers() {
		return Managers;
	}
	public void setManagers(List<Manager> managers) {
		Managers = managers;
	}
	public char getUseStatus() {
		return useStatus;
	}
	public void setUseStatus(char useStatus) {
		this.useStatus = useStatus;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@JsonIgnore
	public Set<String> getPermissionsName() {
		Set<String> list = new HashSet<>();
		List<Resource> perlist = getResources();
		for (Resource per : perlist) {
			list.add(per.getCode());
		}
		return list;
	}

}
